package routes

import (
	"net/http"
	"time"

	"github.com/gin-gonic/gin"
)

func SetApiGroupRoutes(router *gin.RouterGroup) {
	router.GET("/ping", func(ctx *gin.Context) {
		ctx.String(http.StatusOK, "pong")
	})

	router.GET("/test", func(ctx *gin.Context) {
		time.Sleep(5 * time.Second)
		ctx.String(http.StatusOK, "success")
	})

	/*
		已迁到route/user.go
			router.POST("/user/register", func(ctx *gin.Context) {
				var form request.Register
				if err := ctx.ShouldBindJSON(&form); err != nil {
					ctx.JSON(http.StatusOK, gin.H{
						"error": request.GetErrorMsg(form, err),
					})
					return
				}
				ctx.JSON(http.StatusOK, gin.H{
					"message": "success",
				})
			})

			router.POST("/auth/register", app.Register)
			router.POST("/auth/login", app.Login)

			// 使用JWTAuth中间件，客户端需要使用正确的token才能访问在authRouter分组下的路由
			authRouter := router.Group("").Use(middleware.JWTAuth(services.AppGuardName))
			{
				authRouter.POST("/auth/info", app.Info)
				authRouter.POST("/auth/logout", app.Logout)          //登出
				authRouter.POST("/image_upload", common.ImageUpload) //上传
			}
	*/

}
